package chapter_3.demo3;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.function.Predicate;

/**
 * @author: hero生仔
 */
public class Solution {
    public static String processFile(BufferReaderProcessor brp) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("data.txt"));
        return brp.process(br);
    }

    public static void main(String[] args) throws IOException {
        // 当然 可以使用匿名内部类
        processFile(BufferedReader::readLine);

        // 传递行为的方式也可以
        processFile((BufferedReader br) -> br.readLine());

        // 读取两行
        processFile((BufferedReader br) -> br.readLine() + br.readLine());

    }
}
